<template>
    <div>
        <ul class="mui-table-view">
				<li class="mui-table-view-cell mui-media" v-for="item in newsList" :key="item.id">
					<router-link :to="'/home/newslist/'+item.id">
						<img class="mui-media-object mui-pull-left" :src="item.img_url">
						<div class="mui-media-body">
							<h2>{{item.title}}</h2>
							<p class='mui-ellipsis'>
                                <span>发表时间：{{item.add_time | dateFormat()}}</span>
                                <span>点击次数：{{item.click}}</span>
                            </p>
						</div>
					</router-link>
				</li>
				<!-- <li class="mui-table-view-cell mui-media">
					<a href="javascript:;">
						<img class="mui-media-object mui-pull-left" src="../../images/newslist/muwu.jpg">
						<div class="mui-media-body">
							木屋
							<p class='mui-ellipsis'>
                                <span>发表时间：2018-11-01</span>
                                <span>点击次数：0</span>
                            </p>
						</div>
					</a>
				</li>
				<li class="mui-table-view-cell mui-media">
					<a href="javascript:;">
						<img class="mui-media-object mui-pull-left" src="../../images/newslist/index.jpg">
						<div class="mui-media-body">
							CBD
							<p class='mui-ellipsis'>
                                <span>发表时间：2018-11-01</span>
                                <span>点击次数：0</span>
                            </p>
						</div>
					</a>
				</li> -->

			</ul>
    </div>
</template>

<script>

import { Toast } from "mint-ui";
export default {
  data() {
    return {
      newsList: [] // 保存轮播图的数组
    };
  },
  created() {
     this.getNewsList();
  },
  methods: {
    getNewsList() {
      // 获取轮播图数据的方法
      this.$http.get("api/getnewslist").then(result => {
        // console.log(result.body);
        if (result.body.status === 0) {
          // 成功了
          this.newsList = result.body.message;
        } else {
          // 失败的
          Toast("加载新闻列表失败。。。");
        }
      });
    }
  }
};
</script>

<style lang="scss" scoped>
.mui-table-view{
  li{
        h2{
          font-size: 13px;
        }
        .mui-ellipsis{
            font-size: 12px;
            color: blue;
            display: flex;
            justify-content: space-between;
        }
    }
    
}
</style>